const db = require('../util/db.js')

exports.listBook = (book,callback_service)=>{
    var sql
    if(book>0){
        sql = 'select * from book where id = '+ book
    }else{
        sql ='select * from book'
    }
    db.query(sql,'',(data)=>{
        callback_service(data)
    })
}

exports.listBook_category = (book,callback_service)=>{
    var sql
    if(book>0){
        sql = 'select * from book_recommend where id = '+ book
    }else{
        sql ='select * from book_recommend'
    }
    db.query(sql,[],(data)=>{
        callback_service(data)
    })
}

exports.listBook_banner= (book,callback_service)=>{
    var sql
    if(book>0){
        sql = 'select * from book_banner where id = '+ book
    }else{
        sql ='select * from book_banner'
    }
    db.query(sql,[],(data)=>{
        callback_service(data)
    })
}
